<div>
    <!--<a class="pull-right" style="background: #008678; color: #fff; padding: 2px 8px; margin-bottom: 12px; border-radius: 5px;" href="<{PubFunc::buildUrl('/oss/?r=broadcast/add')}>">
        <i class="fa fa-plus"></i> 添加
    </a>-->
    <{if isset($table)}>
    <a class="pull-right" id="truncate" style="background: #00C0EF; color: #fff; padding: 2px 8px; margin-bottom: 12px; border-radius: 5px;margin-right: 20px;" href="#">
                  清除数据
    </a>
    <{/if}>
    <a class="pull-right" style="background: #008678; color: #fff; padding: 2px 8px; margin-bottom: 12px; border-radius: 5px;margin-right: 20px;" href="<{$downUrl}>">
                 下载模板
    </a>
    <input type="hidden" value="<{$table}>" id="de_table" />
    
</div>

<script>
	$("#truncate").click(function(){
		layer.confirm('确定清除该表的数据？', {
			skin: 'layui-layer-molv',
			btn: ['清除','取消'] //按钮
		}, function(){
			var g = $('input[name="g"]').val();
			var url = '/oss/?r=common/truncate&g='+g;
			var table = $("#de_table").val();
			$.ajax({
				type : 'POST',
				url : url,
				data : {'table':table},
				dataType :'JSON',
				success : function(res){
					if(res.status == 1){
						layer.alert('清除成功', {
							skin: 'layui-layer-molv' //样式类名
						    ,closeBtn: 0
						}, function(){
							window.location.reload();
						});
				    }else{
					    layer.msg('操作失败', {icon: 2,time: 2000});
				    }
			    }
		    });

		}, function(){
			
		});
	});
</script>

